package cn.jcby.app.lebu.controller;

import cn.jcby.app.lebu.controller.res.UploadFilesRes;
import cn.jcby.app.lebu.service.UserAlbumService;
import cn.jcby.app.lebu.utils.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author: lihaotian
 * @since: 2023/12/8 01:28
 * @description
 **/
@RestController
@RequestMapping("/file")
@Api(tags="文件上传",description="文件上传")
public class FileController {

    @Autowired
    private UserAlbumService userAlbumService;
    @PostMapping("/upload")
    public Result uploadFiles(@RequestPart("files") MultipartFile[] files) {
        List<UploadFilesRes> data = userAlbumService.uploadFiles(files) ;
        return Result.ok().put("data",data);
    }
}
